import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CakeTypeVO, CakeTypeForm, CakeTypeQuery } from '@/api/sj/cakeType/types';

/**
 * 查询蛋糕大类列表
 * @param query
 * @returns {*}
 */

export const listCakeType = (query?: CakeTypeQuery): AxiosPromise<CakeTypeVO[]> => {
  return request({
    url: '/sj/cakeType/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询蛋糕大类详细
 * @param id
 */
export const getCakeType = (id: string | number): AxiosPromise<CakeTypeVO> => {
  return request({
    url: '/sj/cakeType/' + id,
    method: 'get'
  });
};

/**
 * 新增蛋糕大类
 * @param data
 */
export const addCakeType = (data: CakeTypeForm) => {
  return request({
    url: '/sj/cakeType',
    method: 'post',
    data: data
  });
};

/**
 * 修改蛋糕大类
 * @param data
 */
export const updateCakeType = (data: CakeTypeForm) => {
  return request({
    url: '/sj/cakeType',
    method: 'put',
    data: data
  });
};

/**
 * 删除蛋糕大类
 * @param id
 */
export const delCakeType = (id: string | number | Array<string | number>) => {
  return request({
    url: '/sj/cakeType/' + id,
    method: 'delete'
  });
};
